﻿/// <reference path="script/aui-dialog.js" />
/// <reference path="script/aui-toast.js" />
//==============中文语言=============
var msgTitletishi = "提示";
var msgTitlejinggao = "错误";
var msgContentIsNotEmpty = "请输入完整信息!";
var msgContentIsoperation = "是否执行此操作";
var msgContentOperationOK = "执行成功";
var msgContentOperationNG = "执行失败";
var toast = new auiToast({});
//打开Loading效果
function openLoading() {
    toast.loading({
        title: "加载中",
        duration: 2000
    }, function (ret) {
    });
}
//关闭Loading效果
function closeLoading() {
    toast.hide();
}



//对话框
var dialog = new auiDialog({});
function openDialog(type, title, msg, func, cancelFun) {
    switch (type) {
        case 1:
            dialog.alert({
                title: title,
                msg: msg,
                buttons: ['确定']
            },
                function (ret) {
                    if (func != undefined) {
                        func(ret);
                    }
                });
            break;
        case 2:
            dialog.alert({
                title: title,
                msg: msg,
                buttons: ['取消', '确定']
            },
                function (ret) {
                    if (ret.buttonIndex === 1) {
                        if (cancelFun != undefined) {
                            cancelFun(ret);
                        }
                    }
                    else if (ret.buttonIndex === 2) {
                        if (func != undefined) {
                            func(ret);
                        }
                    }

                });
            break;
        case 3:
            dialog.prompt({
                title: title,
                text: msg,
                buttons: ['取消', '确定']
            },
                function (ret) {
                    if (func != undefined) {
                        func(ret);
                    }
                });
            break;
        default:
            break;

    }
}
var mySwiper;
//初始化Swiper组件
function InitSwiper(swiperClick, tabClick) {
    //切换组件
    mySwiper = new Swiper('.swiper-container',
        {
            //pagination: '.swiper-pagination',分页
            paginationClickable: true,
            onTransitionEnd: function (swiper) {
                var index = swiper.activeIndex;
                $(".aui-tab .aui-active").removeClass('aui-active');
                $(".aui-tab div").eq(index).addClass('aui-active');
                if (swiperClick != undefined) {
                    swiperClick(index);
                }
            }
        });
    //Tab单击事件
    $(".aui-tab div").click(function () {
        var index = $(this).index();
        $(".aui-tab .aui-active").removeClass('aui-active');
        $(".aui-tab div").eq(index).addClass('aui-active');
        mySwiper.slideTo(index, 10, false);
        if (tabClick != undefined) {
            tabClick(index);
        }
    });
}
//0条记录
var noRecordTxt = "<li><p class='aui-text-center'>0条记录</p></li>";

//获取URL参数
function GetQueryString(name) {
    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
    var r = window.location.search.substr(1).match(reg);
    if (r != null) return unescape(r[2]); return null;
}